#!/bin/sh
#BHEADER**********************************************************************
# Copyright (c) 2008,  Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# This file is part of HYPRE.  See file COPYRIGHT for details.
#
# HYPRE is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
# $Revision: 2.7 $
#EHEADER**********************************************************************




#=============================================================================
# This script prints the hypre version number, date, and time by
# grepping the HYPRE_utilities.h file for the HYPRE_Version macro.
#=============================================================================

case $1 in
    -h|-help) 
        echo 
        echo "$0 [options]"
        echo "  -h|-help       - prints usage information"
        echo "  -number        - prints the version number"
        echo "  -date          - prints the version day"
        echo "  -time          - prints the version day and time"
        echo 
        exit;;
esac

# NOTE: In order to call this script from other directories,
# we need to get the path info from the command line
VPATH=`dirname $0`
VFILE="${VPATH}/../HYPRE_config.h"
NUMBER=`grep "HYPRE_RELEASE_VERSION " $VFILE|cut -d\  -f 3|sed 's/"//g'`
DATE=`grep "HYPRE_RELEASE_DATE " $VFILE|cut -d\  -f 3|sed 's/"//g'`
TIME=`grep "HYPRE_RELEASE_TIME " $VFILE|cut -d\  -f 3|sed 's/"//g'`

# this is the no-option print line
VPRINT=`echo hypre Version $NUMBER Date: $DATE`

# this defines the print lines for the various options
case $1 in
    -number)
	VPRINT=$NUMBER;;
    -date)
	VPRINT=$DATE;;
    -time)
	VPRINT=$TIME;;
esac

# print the version information
echo $VPRINT
